\(\int \frac {1}{\sec (x)-\tan (x)} \, dx\) [195]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 9, antiderivative size = 9 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=-\log (1-\sin (x)) \]

[Out]

-ln(1-sin(x))

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3238, 2746, 31} \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=-\log (1-\sin (x)) \]

[In]

Int[(Sec[x] - Tan[x])^(-1),x]

[Out]

-Log[1 - Sin[x]]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 2746

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^(m + (p - 1)/2)*(a - x)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& IntegerQ[(p - 1)/2] && EqQ[a^2 - b^2, 0] && (GeQ[p, -1] ||  !IntegerQ[m + 1/2])

Rule 3238

Int[((a_.) + (b_.)*sec[(d_.) + (e_.)*(x_)] + (c_.)*tan[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Int[Cos[d + e*x
]/(b + a*Cos[d + e*x] + c*Sin[d + e*x]), x] /; FreeQ[{a, b, c, d, e}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x)}{1-\sin (x)} \, dx \\ & = -\text {Subst}\left (\int \frac {1}{1+x} \, dx,x,-\sin (x)\right ) \\ & = -\log (1-\sin (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 18, normalized size of antiderivative = 2.00 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=-2 \log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[(Sec[x] - Tan[x])^(-1),x]

[Out]

-2*Log[Cos[x/2] - Sin[x/2]]

Maple [A] (verified)

Time = 0.24 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.89

method result size
default \(-\ln \left (\sin \left (x \right )-1\right )\) \(8\)
risch \(i x -2 \ln \left ({\mathrm e}^{i x}-i\right )\) \(17\)

[In]

int(1/(sec(x)-tan(x)),x,method=_RETURNVERBOSE)

[Out]

-ln(sin(x)-1)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=-\log \left (-\sin \left (x\right ) + 1\right ) \]

[In]

integrate(1/(sec(x)-tan(x)),x, algorithm="fricas")

[Out]

-log(-sin(x) + 1)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 17 vs. \(2 (7) = 14\).

Time = 0.07 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.89 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=- \log {\left (\tan {\left (x \right )} - \sec {\left (x \right )} \right )} + \frac {\log {\left (\tan ^{2}{\left (x \right )} + 1 \right )}}{2} \]

[In]

integrate(1/(sec(x)-tan(x)),x)

[Out]

-log(tan(x) - sec(x)) + log(tan(x)**2 + 1)/2

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 29 vs. \(2 (9) = 18\).

Time = 0.24 (sec) , antiderivative size = 29, normalized size of antiderivative = 3.22 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=-2 \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} - 1\right ) + \log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right ) \]

[In]

integrate(1/(sec(x)-tan(x)),x, algorithm="maxima")

[Out]

-2*log(sin(x)/(cos(x) + 1) - 1) + log(sin(x)^2/(cos(x) + 1)^2 + 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 20 vs. \(2 (9) = 18\).

Time = 0.28 (sec) , antiderivative size = 20, normalized size of antiderivative = 2.22 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=\log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right ) - 2 \, \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) - 1 \right |}\right ) \]

[In]

integrate(1/(sec(x)-tan(x)),x, algorithm="giac")

[Out]

log(tan(1/2*x)^2 + 1) - 2*log(abs(tan(1/2*x) - 1))

Mupad [B] (verification not implemented)

Time = 22.96 (sec) , antiderivative size = 19, normalized size of antiderivative = 2.11 \[ \int \frac {1}{\sec (x)-\tan (x)} \, dx=\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )-2\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-1\right ) \]

[In]

int(-1/(tan(x) - 1/cos(x)),x)

[Out]

log(tan(x/2)^2 + 1) - 2*log(tan(x/2) - 1)